from typing import Generic, TypeVar

from zkl_pyutils_registries import Matcher

AnyKey = TypeVar("AnyKey")
AnyQuery = TypeVar("AnyQuery")
AnyMatch = TypeVar("AnyMatch")


class Tag(Generic[AnyQuery, AnyKey, AnyMatch]):
    def __init__(self, name: str, matcher: Matcher[AnyQuery, AnyKey, AnyMatch] | None = None):
        self._name = name
        self._matcher = matcher

    @property
    def name(self) -> str:
        return self._name

    @property
    def matcher(self) -> Matcher[AnyQuery, AnyKey, AnyMatch] | None:
        return self._matcher

    def __str__(self):
        return self._name

    def __repr__(self):
        return f"<Tag name={self._name}>"
